package com.example.myapplication;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;

@SuppressWarnings("ALL")
public class MainActivity extends AppCompatActivity {

    private final ArrayList<IpBean> arrayList = new ArrayList<>();
    private final MainAdapter adapter = new MainAdapter(arrayList);
    private final String[] ips = {"139.203.134.244", "223.104.90.8", "112.10.87.52", "122.238.62.125", "36.48.78.60",
            "112.97.213.185", "125.66.79.120", "116.232.64.29", "115.193.181.151", "221.192.178.10", "113.109.118.151",
            "101.93.65.57", "60.23.118.129", "8.135.18.242", "1.189.204.105"};

    private RecyclerView mainRecyclerView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //实例化控件
        //setContentView(R.layout.activity_main);
        mainRecyclerView=findViewById(R.id.mainRecyclerView);
        //初始化数据
        mainRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mainRecyclerView.setAdapter(adapter);
        for(int i=0;i<ips.length;i++){
            IpBean ipBean=new IpBean();
           // ipBean.setIp(ips[i]);
            arrayList.add(ipBean);
        }
        adapter.notifyDataSetChanged();
        //初始化事件
    }

}
